package com.example.mobile2030606155byl042716classwork;

import android.os.Bundle;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private TextView tvMainTitle;
    private RecyclerView rvMainStudent;
    private List<Student> list = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        initData();
        rvMainStudent.setLayoutManager(new LinearLayoutManager(this));
        rvMainStudent.setAdapter(new StudentRVAdapter(list));
    }

    private void initData() {
        list.add(new Student("小明",18,"移动1班","1681343374"));
        list.add(new Student("小白",19,"移动2班","1681341564"));
        list.add(new Student("小黑",17,"移动3班","1681456744"));
        list.add(new Student("小红",18,"移动4班","1681189474"));
        list.add(new Student("小蓝",16,"移动5班","1645646554"));
        list.add(new Student("小龙",15,"移动6班","1688246274"));
        list.add(new Student("小温",19,"移动7班","1681510220"));
        list.add(new Student("小吕",19,"移动8班","1681451474"));
    }

    private void initView() {
        tvMainTitle = findViewById(R.id.tv_main_title);
        rvMainStudent = findViewById(R.id.rv_main_student);
    }
}